<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>注册</title>
    <link rel="shortcut icon" href="./favicon.ico" type="image/x-icon">
    <link rel="stylesheet" type="text/css" href="static/css/reset.css" />
    <link rel="stylesheet" type="text/css" href="static/css/register.css" />
</head>

<body>
    <div class="pos">
        <div class="login">
            <span class="close iconfont icon-close"></span>
            <img src="static/img/login/loginlogo.png" alt="">
            <ul>
                <li></li>
                <li class="phone">使用手机号登陆</li>
                <li></li>
            </ul>
            <form action="" id="form">
                <input style="margin-top: 0;" type="text" name="tel" id="" placeholder="请输入您的手机号">
                <span class="tips2">账号重复</span>
                <input type="password" name="pass" id="" placeholder="请输入密码">
                <span class="tips1">''</span>
                <input type="password" name="pass2" id="" placeholder="请再次输入密码">
                <span class="tips">密码或账号不对</span>
                <div class="clear"></div>
                <button class="loginbtn">注册</button>
            </form>


        </div>
    </div>
    <script src="./jquery.js"></script>
    <script>
        let persons = [{
            "username": "xiaoming1",
            "password": "1111"
        }, {
            "username": "xiaoming2",
            "password": "222"
        }, {
            "username": "xiaoming3",
            "password": "33333"
        }, ]

        $('.loginbtn').click(function (e) {
            e.preventDefault()
            for (k of persons) {
                if ($(':text').val() == k.username) {
                    $('.tips2').css('opacity', '1')
                    return
                } else if ($(':text').val() !== k.username && $('input').eq(1).val() == $('input').eq(2)
                    .val()&&$(':text').val()!=''&&$('input').eq(1).val()!='') {
                    // let newuser = {
                    //     "username": $(':text').val(),
                    //     "password": $('input').eq(1).val()
                    // }
                    // persons.push(newuser)
                    // console.log(persons);
                    location.href = `./login.html?${$(':text').val()}&${$('input').eq(1).val()}`
                    return
                } else {
                    $('.tips').css('opacity', '1')
                }
            }

        })
        $(':text').change(function () {
            console.log(1);
            $(':text').next().css('opacity', '0')
        })
    </script>
</body>

</html>